/*************************************************************************
	> File Name: 1.test.c
	> Author: 
	> Mail: 
	> Created Time: 2021年03月20日 星期六 13时37分49秒
 ************************************************************************/

#include <stdio.h>
#include <stdlib.h>

int main() {
    FILE *fp = NULL;
    char buff[1024] = {0};
    fp = popen("cat 1.test.c", "r");
    if (fp == NULL) {
        perror("popen");
        exit(1);
    }
    while (fread(buff, 1, 1024, fp) > 0) {
        printf("%s", buff);
    }

    fp = popen("cat", "w");
    if (fp == NULL) {
        perror("popen");
        exit(1);
    }

    // while (1) {
        fwrite(buff, 1, 1024, fp);
    // }

    return 0;
}
